﻿Public Class viewprofile
    Inherits System.Web.UI.Page

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		If GlobalApp.Authen IsNot Nothing Then
			GlobalApp.ProfileInfo = BL.Officer.LoadProfile(GlobalApp.Authen.offcier_id)
		End If
		If GlobalApp.ProfileInfo IsNot Nothing Then
			LoadData()
		End If
	End Sub

	Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnNext.Click
		Response.Redirect("viewprofile1.aspx", False)
	End Sub

	Private Sub LoadData()

		Dim registerInfo As Entity.OfficerInfoItem
		registerInfo = GlobalApp.ProfileInfo
		With registerInfo
			Me.OFFICER_APP_ID.Text = Common.Utility.FormatAppId(.officer_app_id)
			Me.OFFCIER_APP_TEL.Text = .offcier_app_tel
			Me.OFFICER_FIRSTNAME_THA.Text = .officer_firstname_tha
			Me.OFFICER_LASTNAME_THA.Text = .officer_lastname_tha
			Me.OFFICER_FIRSTNAME_ENG.Text = .officer_firstname_eng
			Me.OFFICER_LASTNAME_ENG.Text = .officer_lastname_eng
			Common.Utility.SelectChoice(Me.OFFICER_SEX, .officer_sex)
			Me.OFFICER_CARD_NO.Text = .officer_card_no
			Me.OFFICER_BIRTHDATE.value = .officer_birthdate.Value.AddYears(543).ToString("dd/MM/yyyy", Common.Utility.CulInfo)
			If .officer_card_expiredate.HasValue Then
				Me.OFFICER_CARD_EXPIREDATE.value = .officer_card_expiredate.Value.AddYears(543).ToString("dd/MM/yyyy", Common.Utility.CulInfo)
			End If
			Common.Utility.SelectChoice(Me.OFFICER_CARD_EXPIREDATE_TYPE, .officer_card_expiredate_type)
			Common.Utility.SelectChoice(Me.OFFICER_MARRIED_STATUS, .officer_married_status)
		End With
	End Sub

	Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancel.Click
		Me.Response.Redirect("mainpage.aspx", False)
	End Sub

	Protected Sub btnLast_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnLast.Click
		Me.Response.Redirect("viewprofile3.aspx", False)
	End Sub
End Class